<template>
  <div class="goodsList">
    <headers text="黑马商城" style=" position: fixed;
  top: 0;
  left: 0;
  width: 100%;">
      <template #left>
        <van-icon name="arrow-left" @click="$router.back(-1)" />
      </template>
    </headers>
    <div class="goodList"  style="padding-top:40px">
      <goodItemBlock
        v-for="value in goodList"
        :key="value.id"
        :hmgoodList="value"
      ></goodItemBlock>
    </div>
    <footers :list="goods"></footers>
  </div>
</template>

<script>
import headers from "@/components/headers.vue";
import footers from "@/components/footers.vue";
import goodItemBlock from "@/components/goodItemBlock.vue";
import { getGoodList } from "@/apis/goods";
export default {
  components: {
    goodItemBlock,
    footers,
    headers,
  },
  data() {
    return {
      goods: [
        {
          icon: "icon-jia1",
          text: "首页",
          name: "index",
        },
        {
          icon: "icon-huiyuan",
          text: "会员",
          name: "info",
        },
        {
          icon: "icon-gouwuche",
          text: "购物车",
          name: "shop",
        },
        {
          icon: "icon-1-1",
          text: "搜索",
          name: "serach",
        },
      ],
      goodList: [],
    };
  },
  async mounted() {
    let res = await getGoodList({ pageindex: 1 });
    console.log(res);
    this.goodList = res.data.message;
  },
};
</script>

<style scoped>
@import url("//at.alicdn.com/t/font_2621049_2wy8jxt71aw.css");

.goodList {
   padding-bottom: 50px;
  width: 100%;
  padding-left: 5px;
  display: flex;
  justify-content: space-evenly;
  flex-wrap: wrap;
  
}
</style>
